import java.util.Scanner;

public class Main1583 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for (int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int max=0;
        int min=arr[0];
        for (int i=0;i< arr.length;i++){
            if (max<arr[i]){
                max=arr[i];
            }if (min>arr[i]){
                min=arr[i];
            }
        }
        for (int i=0;i< arr.length;i++){
                if (arr[i]==max){
                    int temp=arr[i];
                    arr[i]=temp*2;
                }
                if (arr[i]==min){
                    int temp1=arr[i];
                    arr[i]=temp1+1;
                }
            }
        for (int i=0;i<n;i++){
            System.out.print(arr[i]+" ");
        }
    }
}

